<script>
// @ts-check
// 默认启用vscode提供的ts强类型检查

// 默认导入一揽子vue2.7内常用的组合式api。 prettier忽略本行。
// prettier-ignore
import { defineComponent, ref, computed, watch, nextTick, onMounted } from "vue";

// 默认导入来自lodash-es提供的常用工具。 prettier忽略本行。
// prettier-ignore
import { isArray, isUndefined, isString, isNumber, isNil, isEqual, toString, merge, cloneDeep } from "lodash-es";

import store from "@/store/index.js";
import i18n from "lang/index.js";
import db from "utils/localstorage/main.js";
import request from "utils/request.js";
import router from "@/router/index.js";

/**
 * TopLogo 顶部导航栏的logo标签
 * @author 技术运维中心 阮中楠
 * @description
 * 参考自侧边栏组件提供的logo组件
 */
export default defineComponent({
  name: "TopLogo",
  props: {},
  emits: [],

  components: {},

  setup(props, { attrs, slots, emit, expose }) {
    // @ts-ignore 有疑惑 .png 的类型声明
    const logo = computed(() => require(`@/assets/logo5.png`));

    return {
      logo,
    };
  },

  data() {
    return {};
  },

  computed: {},

  methods: {},

  watch: {},

  created() {},

  mounted() {},
});
</script>

<template>
  <section class="TopLogo-root">
    <div class="sidebar-logo-container">
      <router-link key="expand" class="sidebar-logo-link" to="/">
        <img :src="logo" class="sidebar-logo" />
        <h1 class="sidebar-title">
          {{ $t("system.title") }} 
        </h1>
      </router-link>
    </div>
  </section>
</template>

<style lang="scss" scoped>
.TopLogo-root {
  height: 100%;
  margin-right: 26px;

  // 待优化 更替为合适的选择器名
  .sidebar-logo-container {
    position: relative;
    width: 100%;
    text-align: center;

    // 警告 高度不要内部自己写死 要求外部容器来控制
    // height: 54px;
    // line-height: 54px;

    height: 100%;
    line-height: 100%;

    // background: #272c33;
    // background: white;
    text-align: center;
    overflow: hidden;

    & .sidebar-logo-link {
      display: flex;
      justify-content: flex-start;
      align-items: center;

      height: 100%;
      width: 100%;

      & .sidebar-logo {
        display: inline-block;
        vertical-align: middle;

        // display: block;
        // height: 100%;

        width: 32px;
        // height: 32px;
        margin-right: 12px;
        margin-left: 0px;
        // margin-bottom: -2px;
      }

      & .sidebar-title {
        width: 100%;
        line-height: 30px;
        display: inline-block;
        vertical-align: middle;

        // display: flex;
        // height: 100%;
        // line-height: 100%;

        margin: 0;
        font-weight: 500;
        font-family: PangMenZhengDaoBiao-3;
        font-size: 30px;
        color: #fff;
        white-space: nowrap;
        letter-spacing: -1rem;

        & span {
          font-size: 12px;
          letter-spacing: 1px;
        }
      }
    }

    &.collapse {
      .sidebar-logo {
        margin-right: 0;
      }
    }
  }
}
</style>
